package com.itfenghuang.day01;

public class Student {
//    private :权限访问修饰符  当前类中可以使用
    private String name;
    private int age;
    private String sex;

    public void student(){
        System.out.println("学习");
    }
//    限制年龄的范围
    public void setAge(int age){
//        判断
        if (age>120 || age<0){
            System.out.println("年龄不对");
        }else{
            this.age=age;
        }
    }

    public int getAge(){
        return this.age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
}
